package com.lyf.boot.satoken.config;

import cn.dev33.satoken.dao.SaTokenDao;
import cn.dev33.satoken.jwt.StpLogicJwtForSimple;
import cn.dev33.satoken.stp.StpLogic;
import com.lyf.boot.factory.YmlPropertySourceFactory;
import com.lyf.boot.satoken.core.dao.FrameworkSatokenDao;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * @author Luyufan
 * @date 2024/1/10 16:11
 **/
@Configuration
@PropertySource(value = "classpath:sa-token.yml", factory = YmlPropertySourceFactory.class)
public class FrameworkSaTokenConfig {

//    @Bean
//    public StpInterface stpInterface(){
//        return null;
//    }

    @Bean
    public StpLogic getStpLogicJwt() {
        // Sa-Token 整合 jwt (简单模式)
        return new StpLogicJwtForSimple();
    }

    @Bean
    public SaTokenDao saTokenDao(){
        return new FrameworkSatokenDao();
    }
}
